<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib uri="/WEB-INF/tlds/att.tld" prefix="att"%>
<html>
<head>
<meta name="decorator" content="moduleView" />
<script src="${staticPath}/lib/accounting/0.3.2/accounting.min.js"
	type="text/javascript"></script>
<script type="text/javascript">
	function getUrl(url, iframeId) {
		var frame = $("#" + iframeId);
		if (!frame.attr("src")) {
			frame.attr("src", url);
		}
	}
	function printme() {
		document.body.innerHTML = document.getElementById('home').innerHTML;
		window.print();
	}

	$(document).ready(
			function() {
					});
</script>
</head>
<body>
	<div class="Report_f">
		<div class="Report_f_1">
			<div class="Report_f_title_1">自营结算单</div>
			<div class="o-l-action">
				<a class="btn btn-default btn-sm btn_5 pull-right" role="button"
					href="javascript:void(0)" onclick="history.go(-1)">返回</a>
				<a class="btn btn-success btn-sm btn_5 pull-right" role="button"
					href="${contextPath}/biz/statement/stm/prepaid/exportPrepaidAndDetail?billNo=${stmPrepaid.billNo}&id=${stmPrepaid.id}&companyCode=${stmPrepaid.companyCode}&year=${stmPrepaid.year}">导出</a>
				<a class="btn btn-primary btn-sm btn_5 pull-right btnPrint"
							role="button"
							href="${contextPath}/biz/statement/stm/prepaid/print?billNo=${stmPrepaid.billNo}&id=${stmPrepaid.id}&companyCode=${stmPrepaid.companyCode}&year=${stmPrepaid.year}"
							target="_blank">打印</a>
				<%-- <c:if test='${flag=="1"}'> --%><shiro:hasPermission name="com.maoye.ossp.biz.statement.BizStatementStmPrepaid:add"><c:if test='${stmPrepaid.isReconciliation=="2"||stmPrepaid.isReconciliation=="1"}'>
				   <a class="btn btn-primary btn-sm btn_5 pull-right" role="button"
					href="${contextPath}/biz/statement/stm/prepaid/${stmPrepaid.id}/addInvoice"
					target="_self">我要开票</a></c:if></shiro:hasPermission> <%-- </c:if>  --%><%-- <a
					class="btn btn-warning btn-sm btn_5 pull-right" role="button"
					href="${contextPath}/biz/statement/stm/error/add?id=${stmPrepaid.id}&billNo=${stmPrepaid.billNo}&statementType=ZJ00"><span
					class="glyphicon glyphicon-exclamation-sign"></span>录入异常</a> --%>
					<!--<a class="btn btn-success btn-sm pull-right" role="button"
						href="${contextPath}/statement/stm/prepaid/${stmPrepaid.id}/confirmPrepaid">确认对账</a>-->
			</div>
			<div class="tab-content Report_f_title_3">
				<div class="Report_f_title_5">
					<div class="col-sm-2 leftbar_1">
						<ul class="nav Report_f_title_6">
							<li><a href="#label_1" data-toggle="tab">详细信息</a></li>
							 <%-- <li><a href="#label_2" data-toggle="tab"
								onclick="getUrl('${contextPath}/biz/statement/stm/error/showStatementErrorList?statementType=ZJ00&billNo=${stmPrepaid.billNo}','errorStatementFrame')">结算异常</a></li> --%>
						</ul>
					</div>
					<div class="tab-content Report_f_title_3">
						<div class="tab-pane active" id="label_1">
							<table class="table table-bordered">
								<tbody>
									<tr>
										<td class="text-left" style="width: 20%"><strong>结算单号:</strong></td>
										<td style="width: 30%">${stmPrepaid.billNo}</td>
										<td class="text-left" style="width: 20%"><strong>公司名称:</strong></td>
										<td style="width: 30%">${stmPrepaid.companyName}</td>
									</tr>
									<tr>
									    <td class="text-left" style="width: 20%"><strong>供应商编码:</strong></td>
										<td style="width: 30%">${stmPrepaid.supplierNo}</td>
									    <td class="text-left" style="width: 20%"><strong>供应商合同号:</strong></td>
										<td style="width: 30%">${stmPrepaid.contractNumber}</td>
									</tr>
									<tr>
										<td class="text-left" style="width: 20%"><strong>结算期间:</strong></td>
										<td style="width: 30%"><fmt:formatDate
												value="${stmPrepaid.startTime}" pattern="yyyy-MM-dd" />&nbsp;&nbsp;至&nbsp;&nbsp;<fmt:formatDate
												value="${stmPrepaid.endTime}" pattern="yyyy-MM-dd" /></td>

										<td class="text-left" style="width: 20%"><strong>供应商名称:</strong></td>
										<td style="width: 30%">${stmPrepaid.supplierName}</td>
									</tr>
									<tr>
										<td class="text-left" style="width: 20%"><strong>本期入库金额(元):</strong></td>
										<td style="width: 30%"><fmt:formatNumber
												value="${stmPrepaid.purchaseAmount}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>

										<td class="text-left" style="width: 20%"><strong>本期退货金额(元):</strong></td>
										<td style="width: 30%"><fmt:formatNumber
												value="${stmPrepaid.returnAmount}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>
									</tr>
									<tr>
										<td class="text-left" style="width: 20%"><strong>本期调价金额(元):</strong></td>
										<td style="width: 30%"><fmt:formatNumber
												value="${stmPrepaid.priceAdjustment}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>

										<td class="text-left" style="width: 20%"><strong>本期返利金额(元):</strong></td>
										<td style="width: 30%"><fmt:formatNumber
												value="${stmPrepaid.bebate}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>
									</tr>
									<tr>
										<td class="text-left" style="width: 20%"><strong>本期折扣分摊:</strong></td>
										<td style="width: 30%"><fmt:formatNumber
												value="${stmPrepaid.discountAllocation}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>

										<td class="text-left" style="width: 20%"><strong>本期开票金额(元):</strong></td>
										<td style="width: 30%"><fmt:formatNumber
												value="${stmPrepaid.billingAmount}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>
									</tr>
									<tr>
										<td class="text-left" style="width: 20%"><strong>本期扣款金额(元):</strong></td>
										<td style="width: 30%"><fmt:formatNumber
												value="${stmPrepaid.deductMoney}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>

										<td class="text-left" style="width: 20%"><strong>本期拟付款(元):</strong></td>
										<td style="width: 30%"><fmt:formatNumber
												value="${stmPrepaid.amountPaid}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>
									</tr>
									<tr>
										<td class="text-left" style="width: 20%"><strong>上期未结金额(元):</strong></td>
										<td style="width: 30%"><fmt:formatNumber
												value="${stmPrepaid.prPeriodAccountopen}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>

										<td class="text-left" style="width: 20%"><strong>本期实付款(元):</strong></td>
										<td style="width: 30%"><fmt:formatNumber
												value="${stmPrepaid.quasiPayment}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>
									</tr>
									<tr>
										<td class="text-left" style="width: 20%"><strong>会员卡折让金额(元):</strong></td>
										<td style="width: 30%"><fmt:formatNumber
												value="${stmPrepaid.vipDiscount}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>

									</tr>
								</tbody>
							</table>
							<div class="o-l-search-builder f_9">
								<h4>扣款明细</h4>
								<table
									class="table table-striped table-hover o-l-table table-bordered"
									id="table1">
									<thead class="t_1">
										<tr>
											<th style="width: 200px">费用名称</th>
											<th style="width: 120px">应扣金额</th>
											<th style="width: 120px">实扣金额</th>
 											<th>备注</th>
										</tr>
									</thead>
									<tbody>
										<c:forEach items="${paymentDetailList}" var="paymentDetail">
											<tr>
												<td>${paymentDetail.costName}</td>
												<td><fmt:formatNumber
												value="${paymentDetail.shouldDeductAmount}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>
												<td><fmt:formatNumber
												value="${paymentDetail.realDeductAmount}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>
 												<td>${paymentDetail.auditingRemark}</td>
											</tr>
										</c:forEach>
									</tbody>
								</table>
							</div>
							<div class="o-l-search-builder f_9">
							    <c:if test="${stmPrepaid.contractType!='Z400'}"><h4>采购/调价明细</h4></c:if><!-- (经销) -->
								
								<c:if test="${stmPrepaid.contractType=='Z400'}"><h4>销售明细</h4></c:if><!-- (代销) -->
								<table
									class="table table-striped table-hover o-l-table table-bordered"
									id="table1">
									<thead class="t_1">
										<tr>
											<th>事务类型</th>
											<th>收货凭证日期</th>
											<th>数量</th>
											<th>净价</th>
											<th>税额</th>
											<th>含税金额</th>
											<th>税率税码</th>
										</tr>
									</thead>
									<tbody>
										<c:forEach items="${billDetailList}"
											var="bizStatementBillDetail">
											<tr>
												<td><ossp:value dictType="TRANTYPE"
														key="${bizStatementBillDetail.type}"></ossp:value></td>
												<td><fmt:formatDate
														value="${bizStatementBillDetail.receiveDate}"
														pattern="yyyy-MM-dd " /></td>
												<td>${bizStatementBillDetail.quantity}</td>
												<td><fmt:formatNumber
												value="${bizStatementBillDetail.netPrice}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>
												<td><fmt:formatNumber
												value="${bizStatementBillDetail.tax}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>
												<td><fmt:formatNumber
												value="${bizStatementBillDetail.taxAmount}" pattern="##.##"
												minFractionDigits="2"></fmt:formatNumber></td>
												<td>${bizStatementBillDetail.taxCode}</td>
											</tr>
										</c:forEach>
									</tbody>
								</table>
							</div>
						</div>
						<div class="tab-pane" id="label_2">
							<iframe id="errorStatementFrame" name="errorStatementName"
								scrolling="no" frameborder="no" width="100%"></iframe>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>